<template>
<div>
  <div class="my_div"  v-for="(i,e) in arr" :key="e+1">
    <img
      :src="i.dogImgUrl"
      alt=""
     
    />
    <p  @click='add(i.dogName)' :class="{ 'box': isBox }">{{i.dogName}}</p>
  </div>
  </div>
</template>

<script>
export default {
  props:["arr"],
  
  data() {
    return {
      isBox: false
    };
  },
  methods: {
    add(e) {
      this.isBox = true;
      // console.log(this.arr);
      // console.log(e);
      this.$emit('name',e)
     
    }
  }
};
</script>

<style>
.my_div {
  width: 400px;
  border: 1px solid black;
  text-align: center;
  float: left;
}

.my_div img {
  width: 100%;
  height: 100%;
}

.box{
  background-color: red;
}
</style>